package com.soonoh.simplecube.cube;

public class Vector3f {
	public float X;
	public float Y;
	public float Z;
	
	public Vector3f() {
		this( 0.0f, 0.0f, 0.0f );
	}
	public Vector3f(float x, float y, float z) {
		this.X = x; this.Y = y; this.Z = z;
	}
	
	public float getDotProduct(Vector3f operand) {
		return X*operand.X + Y*operand.Y + Z*operand.Z;
	}
	
	public Vector3f getCrossProduct(Vector3f operand) {
		Vector3f crossVec = new Vector3f();
		crossVec.X = Y*operand.Z - Z*operand.Y;
		crossVec.Y = Z*operand.X - X*operand.Z;
		crossVec.Z = X*operand.Y - Y*operand.X;
		return crossVec;
	}
	
	public float getLength() {
		return (float)Math.sqrt((float)(X*X + Y*Y + Z*Z));
	}
	
	public void normalise() {
		float length = getLength();
		X /= length;
		Y /= length;
		Z /= length;
	}
	
}
